<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 按位与：101 & 1 = 001 => 1
        console.log(5&1)
        // 按位或：101 | 1 = 101 => 5
        console.log(5|1)
        // 取反:~101 = 1...010 => 变正数 =>  先减1=>1...001  取反=> 0...110 => -6
        console.log(~5)
        console.log(~-1)
        // 异或：101 ^ 001 => 100 =>4
        console.log(5^1)
        // 左移：101 => 1010 =>10
        console.log(5<<1)
        // 右移动:101 => 010 => 2
        console.log(5>>1)
        // 零填充右位移 101 => 010 =>2
        console.log(5>>>1)
        // 1...101 => 0...010
        console.log(-5>>>1)
    </script>
</body>
</html>